package com.gnerv.battle.boot.module.base.model.bo;

import com.gnerv.battle.boot.module.base.model.entity.Account;
import com.gnerv.battle.boot.common.tools.DateTimeTools;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author Gnerv LiGen
 */
@Data
public class AccountBO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    private String ukId;
    private String username;
    private String password;
    private String status;
    private Integer sort;

    public Account toCreateAccount() {
        Account account = new Account();
        BeanUtils.copyProperties(this, account);
        account.setGmtCreate(DateTimeTools.currentTimeMillis());
        account.setGmtModified(DateTimeTools.currentTimeMillis());
        return account;
    }

    public Account toUpdateAccount() {
        Account account = new Account();
        BeanUtils.copyProperties(this, account);
        account.setGmtModified(DateTimeTools.currentTimeMillis());
        return account;
    }

}